<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="s_folder" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <a v-for="dict in s_tree_menu" @click="handleNodeClick(dict)" type='primary'>{{dict.__desc}}></a>
      </div>
      <el-button @click="gotoPage('CB0365A0533645D7B6A7374FBF84457B?&cpopup=reload'+vueparams+'')" type='primary' size="mini">新文件夹</el-button>
      <div class="form-unit">
        <span class="mvc-title-left"> 文件夹列表 </span>
      </div>
      <el-table :data="s_folder">
        <el-table-column label="操作" align="center" width='100' type=''>
          <template slot-scope="scope">
            <el-dropdown trigger="click">
              <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="d_folders('&CMIDSEL1='+scope.row.folder_id+'')">删除</el-link>
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
        <el-table-column label="文件夹" prop="icon">
          <template slot-scope="scope">
            <img src='images/icons/talent/nopic.jpg' width='16' height='16' />
            <el-link @click="gotoPage('1D6133F16B6641909D78A295F1698C42?&CMID9='+scope.row.folder_id+''+vueparams+'')" type='primary'>{{scope.row.subject}}</el-link>
          </template>
        </el-table-column>
      </el-table>
      <el-button @click="gotoPage('84294145F7724CCB8BC3FA0270D7D272?&cpopup=reload'+vueparams+'')" type='primary' size="mini">上传文件</el-button>
      <el-button @click="popProductOfficeTecFile('')" type='primary' size="mini">创建文件</el-button>
      <pagination v-show="total>0" :total="total" :limit.sync="pageSize" @pagination="getPage" />
      <div class="form-unit">
        <span class="mvc-title-left"> 文件列表 </span>
      </div>
      <el-table :data="s_file">
        <el-table-column label="操作" align="center" width='100' type=''>
          <template slot-scope="scope">
            <el-dropdown trigger="click">
              <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>
                  <el-link @click="gotoPage('1929DCE7E0114329956AF8847DD25157?&CMID4='+scope.row.item_id+''+vueparams+'')">增加版本</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="d_file('&CMID4='+scope.row.item_id+'')">删除</el-link>
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
        <el-table-column label="文件" prop="icon">
          <template slot-scope="scope">
            <img src='images/icons/talent/nopic.jpg' width='16' height='16' />
            <el-link @click="gotoPage('4A506CDCD3F941469FCC4605BF849BAB?&CMID4='+scope.row.item_id+''+vueparams+'')" type='primary'>{{scope.row.client_filename}}</el-link>
          </template>
        </el-table-column>
        <el-table-column label="类型" prop="type_desc">
        </el-table-column>
        <el-table-column label="id" prop="item_id">
        </el-table-column>
        <el-table-column label="尺寸" prop="size">
        </el-table-column>
        <el-table-column label="版本" prop="version">
        </el-table-column>
        <el-table-column label="修改日期" prop="modified">
        </el-table-column>
      </el-table>
      <pagination v-show="total>0" :total="total" :limit.sync="pageSize" @pagination="getPage" />
    </el-form>
    <el-dialog :visible.sync="ProductOfficeTecFileVisible" append-to-body>
      <ProductOfficeTecFile v-if="ProductOfficeTecFileVisible" ref="ProductOfficeTecFile" :popparams="popparams"> </ProductOfficeTecFile>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import ProductOfficeTecFile from "@/views/mes/product/ProductOfficeTecFile";
  export default {
    name: 'PersonalFileList',
    components: {
      ProductOfficeTecFile,
    },
    props: ['popparams'],
    data() {
      return {
        ProductOfficeTecFileVisible: false,
        ProductOfficeTecFileValue: null,
        ProductOfficeTecFileDesc: null,
        vueparams: this.getVUEParams(""),
        s_folder: [],
        s_file: [],
        s_tree_menu: [],
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/systemadmin/PersonalFileList/personalFileList?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      popProductOfficeTecFile(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.ProductOfficeTecFileVisible = !this.ProductOfficeTecFileVisible;
      },
      handleOutline(data) {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/systemadmin/PersonalFileList/s_tree_menu?' + this.vueparams,
        }).then(data => {
          this.s_tree_menu = data.s_tree_menu;
          this.s_tree_menu = this.s_tree_menu.reverse();
        })
      },
    },
  }
</script>
